package com.dandan.tzx.router;

import android.content.Context;
import android.content.Intent;
import android.support.v4.app.ActivityCompat;
import android.util.Log;

import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.facade.service.DegradeService;
import com.dandan.tzx.activity.DefalutActivity;

/**
 * Created by tanzhenxing
 * Date: 2018/1/6 下午5:17
 * Description: 降级处理
 */
@Route(path = DegradeServiceImpl.PATH)
public class DegradeServiceImpl implements DegradeService {
    public static final String PATH = "/service/DegradeServiceImpl";
    @Override
    public void onLost(Context context, Postcard postcard) {
        Log.d("tanzhenxing", "onLost() called with: context = [" + context + "], postcard = [" + postcard.getPath() + "]");
        if (context != null && postcard.getGroup().equals("activity")) {
            ActivityCompat.startActivity(context, new Intent(context, DefalutActivity.class), null);
        }

    }

    @Override
    public void init(Context context) {
        Log.d("tanzhenxing", "init() called with: context = [" + context + "]");

    }
}


